package com.wenwan.manage.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wenwan.manage.service.LogisticsService;

import javax.annotation.Resource;

/***
 * 快递单号查询
 * 
 * @author Admin
 *
 */
@Controller
@RequestMapping(value = "/logistics")
public class LogisticsController {

	@Autowired
	private LogisticsService logisticsService;

	/**
	 * 通过快递单号获取所属的快递
	 * 
	 * @param courierNumber
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/get/auto/number", method = { RequestMethod.GET })
	public Map<String, Object> getAutoNumber(@RequestParam(required = true) String courierNumber) {
		return logisticsService.getAutoNumber(courierNumber);
	}

	/**
	 * 通过完整的快递单号获取物流信息
	 * 
	 * @param type
	 * @param postid
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/get/logistics", method = { RequestMethod.GET })
	public Map<String, Object> getLogistics(@RequestParam(required = true) String type,
			@RequestParam(required = true) String postid) {
		return logisticsService.getLogistics(type, postid);
	}

}
